<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 检查数组是否经排序和轮转得到 -->
    <script>
      function check(nums) {
        return (
          nums
            //连接两个或多个数组
            .concat(nums)
            //将数组中所有的元素替换成一个字符串
            .join()
            //判断字符串中是否包含指定的子字符串
            .includes(nums.sort((a, b) => a - b).join())
        )
      }
      console.log(check([3, 4, 5, 1, 2]))
    </script>
  </body>
</html>
